package com.scheudler.demo.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author dongqun
 * @version 1.0
 * @description 定时任务工厂：定时执行什么任务
 * @date 2019/9/24 14:12
 */
public class QuartzFactory implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        ScheduleJob job = (ScheduleJob) jobExecutionContext.getMergedJobDataMap().get("scheduleJob");
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");

        System.out.println("收到指令："+ job.getJobTask()+"----"+format.format(new Date()));
    }
}
